<!DOCTYPE html>
<html style="height: 100%">

<head>
    <meta charset="utf-8">
</head>

<body style="height: 100%; margin: 0">
    <div id="container" style="height: 100%"></div>
    <script src="echarts.min.js"></script>
    <script type="text/javascript" src="base.js"></script>
    <script>
        var dom = document.getElementById('container');
        var myChart = echarts.init(dom, null, {
            renderer: 'canvas',
            useDirtyRect: false
        });

        const upColor = '#ec0000';
        const upBorderColor = '#8A0000';
        const downColor = '#00da3c';
        const downBorderColor = '#008F28';
        var option;

        function setData(optionPy) {
            executeMethodInJson(optionPy);
            option = optionPy;
            drawChart();
        }

        function drawChart() {
            myChart.setOption(option);
        }
        window.addEventListener('resize', myChart.resize);

        function calculateMA(dayCount) {
            var result = [];
            for (var i = 0, len = klineData.length; i < len; i++) {
                if (i < dayCount) {
                    result.push('-');
                    continue;
                }
                var sum = 0;
                for (var j = 0; j < dayCount; j++) {
                    sum += +klineData[i - j][1];
                }
                result.push(sum / dayCount);
            }
            return result;
        }
    </script>
</body>

</html>